#pragma once

#include "types.h"

namespace xml {

struct attribute_not_found : exception {
	virtual const char * what() const throw() {
		return "attribute not found";
	}
};

struct attribute_parse_error : exception {
	virtual const char * what() const throw() {
		return "attribute parse error";
	}
};

struct stream_parse_error : exception {
	virtual const char * what() const throw() {
		return "stream parse error";
	}
};

struct invalid_name : exception {
	virtual const char * what() const throw() {
		return "tag or attribute name is invalid";
	}
};

class not_found : public exception {
public:
	not_found(const filter & f) throw()
		{ _msg = "Node not found (" + f.describe() + ")"; }
public:
	virtual const char * what() const throw()
		{ return _msg.c_str();	}
private:
	string	_msg;
};

class ambiguous : public exception {
public:
	ambiguous(const filter & f) throw()
		{ _msg = "Node is ambiguous (" + f.describe() + ")"; }
public:
	virtual const char * what() const throw()
		{ return _msg.c_str();	}
private:
	string	_msg;
};

} // xml
